﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StyleMVVM.DependencyInjection.Impl;

namespace StyleMVVM.DependencyInjection.Conditions
{
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
	public class ExportWhenAppSettingNotPresentOrFalseAttribute : Attribute, IExportConditionAttribute
	{
		private string appSetting;
		private bool cacheAnswer;

		public ExportWhenAppSettingNotPresentOrFalseAttribute(string appSetting)
		{
			this.appSetting = appSetting;
			this.cacheAnswer = true;
		}

		public ExportWhenAppSettingNotPresentOrFalseAttribute(string appSetting, bool cacheAnswer)
		{
			this.appSetting = appSetting;
			this.cacheAnswer = cacheAnswer;
		}

		public IExportCondition ProvideCondition(Type exportType)
		{
			return new WhenAppSettingNotPresentOrFalse(appSetting, cacheAnswer);
		}
	}
}